package com.medusa.aps.business.modules.plan.mp.entity;

import cn.hutool.core.annotation.Alias;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.medusa.aps.business.model.BaseEntity;
import com.medusa.aps.business.model.enums.ProductionType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * 采购计划实体类
 *
 * @author yuxh
 * @since 2023-08-14 17:37:49
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class PurchasePlan extends BaseEntity<PurchasePlan> {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "主键id")
    private Integer id;
    /**
     * 订单号
     */
    @Schema(description = "订单号")
    @Alias("订单号")
    private String orderNumber;
    /**
     * 物料id
     */
    @Schema(description = "物料id")
    private Long materialId;
    /**
     * 物料编码
     */
    @Schema(description = "物料编码")
    @Alias("物料编码")
    private String itemCode;

    /**
     * 物料分类
     */
    @Schema(description = "物料分类")
    @Alias("物料分类")
    private String itemType;
    /**
     * 物料名称
     */
    @Schema(description = "物料名称")
    @Alias("物料名称")
    private String itemName;
    /**
     * 规格
     */
    @Schema(description = "规格")
    @Alias("规格")
    private String specification;
    /**
     * 单位
     */
    @Schema(description = "单位")
    @Alias("单位")
    private String unit;
    /**
     * 数量
     */
    @Schema(description = "数量")
    @Alias("数量")
    private BigDecimal quantity;
    /**
     * 需求期
     */
    @Schema(description = "需求日期")
    @Alias("需求日期")
    private LocalDate demandPeriod;
    /**
     * 预计到货日期
     */
    @Schema(description = "预计到货日期")
    @Alias("预计到货日期")
    private LocalDate procurementLeadTime;
    /**
     * 建议采购日期
     */
    @Schema(description = "建议采购日期")
    @Alias("建议采购日期")
    private LocalDate proposedPurchaseDate;

    /**
     * 供应商 id
     */
    @Schema(description = "供应商 id")
    private Long supplierId;

    /**
     * 供应商编码
     */
    @Schema(description = "供应商编码")
    @Alias("供应商编码")
    private String supplierCode;
    /**
     * 供应商名称
     */
    @Schema(description = "供应商名称")
    @Alias("供应商名称")
    private String supplierName;

    /**
     * 创建人
     */
    @Schema(description = "创建人")
    @TableField(value = "creator", fill = FieldFill.INSERT)
    @JSONField(serialize = false, deserialize = false)
    private String creator;

    /**
     * 生产类型
     */
    @Alias(" 生产类型 ")
    @Schema(description = "生产类型")
    private ProductionType productionType;

    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }
}

